package com.adou.d5.demo;

import java.util.Scanner;

public class Test {
    public static void main(String[] args) {
        // 1 设计一个电影类
        // 2 设计一个电影操作类
        // 3 准备全部电影数据
        Movie[] movies = new Movie[4];
        movies[0] = new Movie(1,"水门桥", 38.9, 9.8, "徐克", "吴京","12万人想看");
        movies[1] = new Movie(2, "出拳吧", 39, 7.8, "唐晓白", "田雨","3.5万人想看");
        movies[2] = new Movie(3,"月球陨落", 42, 7.9, "罗兰", "贝瑞","17.9万人想看");
        movies[3] = new Movie(4,"一点就到家", 35, 8.7, "许宏宇", "刘昊然","10.8万人想看");

        // 4创建一个电影操作类对象，电影电影数据，并且处理业务
        MovieOperator movieOperator = new MovieOperator(movies);

        Scanner sc = new Scanner(System.in);
        while (true) {
            System.out.println("===电影信息系统===");
            System.out.println("1：查看所有电影信息");
            System.out.println("2：根据id查询电影信息");
            System.out.println("请输入操作编号：");
            int command = sc.nextInt();
            // 5根据id查询电影信息
            switch (command) {
                case 1:
                    movieOperator.printAllMovie();
                    break;
                case 2:
                    System.out.println("请输入电影id:");
                    int id = sc.nextInt();
                    movieOperator.getMovieById(id);
                    break;
                default:
                    System.out.println("你输入有误，请重新输入");
            }
        }


    }
}
